﻿<UserControl x:Class="nRoute.Samples.Netflix.Views.PeopleListingView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
	xmlns:n="http://nRoute/schemas/2010/xaml" 
	xmlns:local_Controls="clr-namespace:nRoute.Samples.Netflix.Controls" 
	xmlns:local_Behaviors="clr-namespace:nRoute.Samples.Netflix.Behaviors" 
	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 	
	n:Navigation.Title="Persons Listing"
    mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="320">
    
	<i:Interaction.Behaviors>
		<n:BridgeViewModelBehavior/>
	</i:Interaction.Behaviors>
    
    <Grid x:Name="LayoutRoot" Background="White">
    	
    	<Grid>	    	
			<Grid.RowDefinitions>
		        <RowDefinition Height="Auto"/>
		        <RowDefinition Height="*"/>
		        <RowDefinition Height="Auto"/>
		    </Grid.RowDefinitions>
	    		
	    	<Border Height="32" Background="#FFF1F1F1" VerticalAlignment="Top" BorderBrush="#FFDADADA" 
				BorderThickness="0,0,0,1">
	    		
				<i:Interaction.Behaviors>
					<n:BoolValueVisibilityBehavior Value="{Binding IsSearching}"/>
				</i:Interaction.Behaviors>
				<Grid>
					<TextBlock Margin="34,0,8,0" TextWrapping="NoWrap" FontFamily="Trebuchet MS" 
						Text="{Binding SearchText, StringFormat=Results for ΄\{0\}΄}" 
						FontSize="16" Foreground="#FFA7A7A7" VerticalAlignment="Center" TextTrimming="WordEllipsis">
						<TextBlock.Effect>
							<DropShadowEffect ShadowDepth="1" BlurRadius="2" Color="White" Direction="-247"/>
						</TextBlock.Effect>
					</TextBlock>
					<Path Data="M11,6 C11,8.7614241 8.7614241,11 6,11 C3.2385762,11 1,8.7614241 1,6 C1,3.2385762 3.2385762,1 6,1 C8.7614241,1 11,3.2385762 11,6 z M9.1339722,9.9879999 L13.508972,14.62" HorizontalAlignment="Left" Margin="12,0,0,0" Stretch="Fill" Stroke="#FF8D8C8C" StrokeThickness="2" UseLayoutRounding="False" Width="14.5" Height="15.5" VerticalAlignment="Center"/>
				</Grid>
			</Border>
			
			<ListBox x:Name="PersonsListBox" Width="320" BorderThickness="0" Padding="0" ItemsSource="{Binding Listing}"
				ItemTemplate="{StaticResource TopicTitleTemplate}" Grid.Row="1"
				ItemContainerStyle="{StaticResource TopicTitleBoxItemStyle}" 
				ScrollViewer.HorizontalScrollBarVisibility="Disabled"
				ScrollViewer.VerticalScrollBarVisibility="Auto">
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="SelectionChanged">
						<i:Interaction.Behaviors>
							<ei:ConditionBehavior>
								<ei:ConditionalExpression>
									<ei:ComparisonCondition LeftOperand="{Binding SelectedIndex, ElementName=PersonsListBox}" Operator="NotEqual" RightOperand="-1"/>
								</ei:ConditionalExpression>
							</ei:ConditionBehavior>
						</i:Interaction.Behaviors>
						<n:NavigateAction HandlerName="ContentContainer" Url="Content/Netflix/Person/" >
							<n:DependencyParameter Key="Person" Value="{Binding SelectedItem, ElementName=PersonsListBox}"/>
						</n:NavigateAction>
					</i:EventTrigger>
				</i:Interaction.Triggers>
			</ListBox>
			
			<Border Height="40" Background="#FFF1F1F1" VerticalAlignment="Top" BorderBrush="#FFDADADA" 
				BorderThickness="0,0,0,1" Cursor="Hand" Grid.Row="2">
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="MouseLeftButtonDown">
						<n:ExecuteCommandAction Command="{Binding LoadMoreCommand}"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>			
				<i:Interaction.Behaviors>
					<n:BoolValueVisibilityBehavior Value="{Binding IsLoaded}" Negate="True"/>
					<n:BoolValueDisableBehavior Value="{Binding IsLoading}" DisableOpacity="0.2"/>
				</i:Interaction.Behaviors>
				<Grid>
					<TextBlock Margin="34,0,8,0" TextWrapping="NoWrap" FontFamily="Trebuchet MS" TextTrimming="WordEllipsis"
						Text="Load More.." FontSize="16" Foreground="#FFA7A7A7" VerticalAlignment="Center">
						<TextBlock.Effect>
							<DropShadowEffect ShadowDepth="1" BlurRadius="2" Color="White" Direction="-247"/>
						</TextBlock.Effect>
					</TextBlock>
					<Path Data="M5.2319946,1 L5.312995,10.589 M9.5506897,7.3135071 L4.5906897,12.572507 M1,7.2724915 L5.868,12.572492" HorizontalAlignment="Left" Margin="13.743,0,0,0" Stretch="Fill" Stroke="#FF8D8C8C" StrokeThickness="2" UseLayoutRounding="False" Width="10.551" Height="13.573" VerticalAlignment="Center"/>
				</Grid>
			</Border>
				
			
		</Grid>
		
		<local_Controls:WorkingIndicator IsWorking="{Binding IsLoading}" Visibility="Collapsed"/>
		
    </Grid>
</UserControl>
